-module(error).
-compile([export_all]).

%% Check that errors are reported for invalid library/function
%% what is portable way to do that with dlopen/dlsym?

main() ->
    {error, mod_not_found} = ffi:load_library("unexistant"),
    {ok, Lib} = ffi:load_library("build/types"),
    Err = (catch {ok, ffi:call(Lib, "unexistant", [1,2,3])}),
    case Err of
        proc_not_found -> ok;
	{dlerror, "build/types.so: undefined symbol: unexistant"} -> ok
    end,
    util:die().
